package com.chinairi.mall.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chinairi.mall.model.StorageAddress;
import com.chinairi.mall.dao.StorageAddressMapper;
import com.chinairi.mall.model.SysUser;
import com.chinairi.mall.service.IStorageAddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 库点主数据表 服务实现类
 * </p>
 *
 * @author Webgasd
 * @since 2020-10-13
 */
@Service
public class StorageAddressServiceImpl extends ServiceImpl<StorageAddressMapper, StorageAddress> implements IStorageAddressService {
    @Autowired
    private StorageAddressMapper storageAddressMapper;

    /**
     * 获取所有库点的列表
     *
     * @param storageAddress
     * @return
     */
    @Override
    public List<StorageAddress> getStorageAddressList(StorageAddress storageAddress) {
        QueryWrapper<StorageAddress> wrapper = new QueryWrapper<>();
        wrapper
                .eq(StringUtils.isNotEmpty(storageAddress.getSaType()),"SA_TYPE",storageAddress.getSaType())
                .eq(StringUtils.isNotEmpty(storageAddress.getSaIsVir()),"SA_IS_VIR",storageAddress.getSaIsVir())
                .eq(StringUtils.isNotEmpty(storageAddress.getSaIsDir()),"SA_IS_DIR",storageAddress.getSaIsDir());
        List<StorageAddress> list = storageAddressMapper.selectList(wrapper);
        return list;
    }
}
